//
//  XGL_MessageChatInputBarView.swift
//  XGamesLive
//
//  Created by ios on 2024/5/27.
//

import UIKit

class XGL_MessageChatInputBarView: UIView {
    var photoItem: UIButton!
    var imageItem: UIButton!
    var videoItem: UIButton!
    var giftItem: UIButton!

    override init(frame: CGRect) {
        super.init(frame: frame)
        self.createXglView()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}

extension XGL_MessageChatInputBarView{
    private func createXglView(){
        self.photoItem = UIButton().then({ make in
            make.setImage(imageWithName("img_xgl_message_input_bar_photo"), for: .normal)
        })
        self.imageItem = UIButton().then({ make in
            make.setImage(imageWithName("img_xgl_message_input_bar_image"), for: .normal)
        })
        self.videoItem = UIButton().then({ make in
            make.setImage(imageWithName("img_xgl_message_input_bar_video"), for: .normal)
        })
        self.giftItem = UIButton().then({ make in
            make.setImage(imageWithName("img_xgl_message_input_bar_gift"), for: .normal)
        })
        self.addSubviews([photoItem,imageItem,videoItem,giftItem])
        let space = (ScreenWidth - 30 - 48.0 * 4) / 3.0
        photoItem.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.left.equalTo(15.0)
            make.width.height.equalTo(48.0)
        }
        imageItem.snp.makeConstraints { make in
            make.centerY.height.width.equalTo(photoItem)
            make.left.equalTo(photoItem.snp.right).offset(space)
        }
        videoItem.snp.makeConstraints { make in
            make.centerY.height.width.equalTo(photoItem)
            make.right.equalTo(giftItem.snp.left).offset(-space)
        }
        giftItem.snp.makeConstraints { make in
            make.centerY.height.width.equalTo(photoItem)
            make.right.equalTo(-15.0)
        }

    }
}
